package fr.utt.lo02.CrazyEights.view.GamePanel;


import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import fr.utt.lo02.CrazyEights.model.Game;

/**
 * Represents a game with 7 players
 * @author Jeremy
 *
 */
public class SevenPlayersPanel extends PlayersPanel{
	
	private static final long serialVersionUID = 1L;

	public SevenPlayersPanel(){
		this.setLayout(new GridBagLayout());
		int CurrentPlayerIndex;
		CurrentPlayerIndex = Game.getInstance().getPlayersList().getPlayersList().indexOf(Game.getInstance().getPlayersList().getCurrentPlayer());
		switch(CurrentPlayerIndex){
		case 0:
			//Top 1
			this.addComponent(Game.getInstance().getPlayersPanels().get(2), 0, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 2
			this.addComponent(Game.getInstance().getPlayersPanels().get(3), 1, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 3
			this.addComponent(Game.getInstance().getPlayersPanels().get(4), 2, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 4
			this.addComponent(Game.getInstance().getPlayersPanels().get(5), 3, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Left
			this.addComponent(Game.getInstance().getPlayersPanels().get(1), 0, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Right
			this.addComponent(Game.getInstance().getPlayersPanels().get(6), 3, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			break;
		case 1:
			//Top 1
			this.addComponent(Game.getInstance().getPlayersPanels().get(3), 0, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 2
			this.addComponent(Game.getInstance().getPlayersPanels().get(4), 1, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 3
			this.addComponent(Game.getInstance().getPlayersPanels().get(5), 2, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 4
			this.addComponent(Game.getInstance().getPlayersPanels().get(6), 3, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Left
			this.addComponent(Game.getInstance().getPlayersPanels().get(2), 0, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Right
			this.addComponent(Game.getInstance().getPlayersPanels().get(0), 3, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			break;
		case 2:
			//Top 1
			this.addComponent(Game.getInstance().getPlayersPanels().get(4), 0, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 2
			this.addComponent(Game.getInstance().getPlayersPanels().get(5), 1, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 3
			this.addComponent(Game.getInstance().getPlayersPanels().get(6), 2, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 4
			this.addComponent(Game.getInstance().getPlayersPanels().get(0), 3, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Left
			this.addComponent(Game.getInstance().getPlayersPanels().get(3), 0, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Right
			this.addComponent(Game.getInstance().getPlayersPanels().get(1), 3, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			break;
		case 3:
			//Top 1
			this.addComponent(Game.getInstance().getPlayersPanels().get(5), 0, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 2
			this.addComponent(Game.getInstance().getPlayersPanels().get(6), 1, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 3
			this.addComponent(Game.getInstance().getPlayersPanels().get(0), 2, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 4
			this.addComponent(Game.getInstance().getPlayersPanels().get(1), 3, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Left
			this.addComponent(Game.getInstance().getPlayersPanels().get(4), 0, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Right
			this.addComponent(Game.getInstance().getPlayersPanels().get(2), 3, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			break;
		case 4:
			//Top 1
			this.addComponent(Game.getInstance().getPlayersPanels().get(6), 0, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 2
			this.addComponent(Game.getInstance().getPlayersPanels().get(0), 1, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 3
			this.addComponent(Game.getInstance().getPlayersPanels().get(1), 2, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 4
			this.addComponent(Game.getInstance().getPlayersPanels().get(2), 3, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Left
			this.addComponent(Game.getInstance().getPlayersPanels().get(5), 0, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Right
			this.addComponent(Game.getInstance().getPlayersPanels().get(3), 3, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			break;
		case 5:
			//Top 1
			this.addComponent(Game.getInstance().getPlayersPanels().get(0), 0, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 2
			this.addComponent(Game.getInstance().getPlayersPanels().get(1), 1, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 3
			this.addComponent(Game.getInstance().getPlayersPanels().get(2), 2, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 4
			this.addComponent(Game.getInstance().getPlayersPanels().get(3), 3, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Left
			this.addComponent(Game.getInstance().getPlayersPanels().get(6), 0, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Right
			this.addComponent(Game.getInstance().getPlayersPanels().get(4), 3, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			break;
		case 6:
			//Top 1
			this.addComponent(Game.getInstance().getPlayersPanels().get(1), 0, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 2
			this.addComponent(Game.getInstance().getPlayersPanels().get(2), 1, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 3
			this.addComponent(Game.getInstance().getPlayersPanels().get(3), 2, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Top 4
			this.addComponent(Game.getInstance().getPlayersPanels().get(4), 3, 0, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Left
			this.addComponent(Game.getInstance().getPlayersPanels().get(0), 0, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			//Right
			this.addComponent(Game.getInstance().getPlayersPanels().get(5), 3, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
			break;
		}
		//StockPile
		this.addComponent(Game.getInstance().getStockPilePanel(), 1, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.LINE_END, new Insets(140,0,140,5));
		//DiscardPile
		this.addComponent(Game.getInstance().getDiscardPilePanel(), 2, 1, 0.25, 0, 1, 1, GridBagConstraints.NONE, GridBagConstraints.LINE_START, new Insets(140,5,140,0));
		//Bottom
		this.addComponent(Game.getInstance().getPlayersPanels().get(CurrentPlayerIndex), 0, 2, 0, 0, 4, 1, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(0,0,0,0));
	}

}